<script>
    class List {
        constructor(data) {
            this.node = {
                value: data,
                next: null,
                prev: null,
            }
            this.list = [this.node]
        }
        put(data) {
            const node = {
                value: data,
                next: null,
                prev: this.list[this.list.length - 1],
            }
            this.list[this.list.length - 1].next = node
            this.list.push(node)
        }
        insert(value, index) {
            if (index > this.list.length) {
                return this.put(value)
            }
            const node = {
                value,
                next: this.list[index + 1],
                prev: this.list[index],
            }
            this.list[index].next = node
            this.list[index + 1].prev = node
            this.list.push(node)
        }
        take(node) { }
        get() {
            return this.list
        }
        del(node, index) {

        }
    }
    const list = new List(1)
    list.put(2)
    list.insert(3, 0)
    console.log(list, list.get())
</script>